package com.project.im.common.enums;

import lombok.experimental.UtilityClass;

@UtilityClass
public class EnumUtils {
    public <T extends BaseEnum<R>, R> T getByCode(Class<T> clazz, R value) {
        for (T each : clazz.getEnumConstants()) {
            if (each.getCode().equals(value)) {
                return each;
            }
        }
        return null;
    }
}
